<template>
  <div>
    <el-table v-loading="loading" tooltip-effect="darkTable" :data="dealMattersList" border height="200">
      <el-table-column :label="$t('申请标题')" align="center" prop="actTitle" :show-overflow-tooltip="true" />
      <el-table-column :label="$t('发生时间')" align="center" prop="happenTime" show-overflow-tooltip width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.happenTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('事项类别')" align="center" prop="itemType" :formatter="itemTypeFormat" show-overflow-tooltip width="100" />
      <el-table-column :label="$t('是否处理')" align="center" prop="handle" :formatter="handleFormat" show-overflow-tooltip width="100" />
    </el-table>
  </div>
</template>
<script>
import { listDealMatters } from '@/api/deal/matters/dealMatters'
  export default {
    name: 'DealMattersInfo',
    props: {
      // 公司ID
      bussId: {
        type: String,
        required: true
      }
    },
    data() {
      return {
        // 遮罩层
        loading: true,
        // 总条数
        total: 0,
        // 指标监控表格数据
        dealMattersList: [],
        // 事项类别 字典deal_matters_category字典
        itemTypeOptions: [],
        // 是否处理 字典sys_yes_no字典
        handleOptions: [],
        // 查询参数
        queryParams: {
          dealId: this.bussId,
          pageNum: 1,
          pageSize: 10
        },
        // 表单参数
        form: {}
      }
    },
    created() {
      this.getDicts('deal_matters_category').then(response => {
        this.itemTypeOptions = response.data
      })
      this.getDicts('sys_yes_no').then(response => {
        this.handleOptions = response.data
      })
      this.getList()
    },
    methods: {
      // 事项类别 字典deal_matters_category字典翻译
      itemTypeFormat(row) {
        return this.selectDictLabel(this.itemTypeOptions, row.itemType)
      },
      // 是否处理 字典sys_yes_no字典翻译
      handleFormat(row) {
        return this.selectDictLabel(this.handleOptions, row.handle)
      },
      getList() {
        this.loading = true
        this.queryParams.dealId = this.bussId
        listDealMatters(this.queryParams).then(response => {
          this.dealMattersList = response.rows
          this.loading = false
        })
      }
    }
  }
</script>
